// SnCliPlugin.cpp : Implementation of CSnCliPlugin

#include "stdafx.h"
#include "SnCliPlugin.h"

//
// Flow macros
// 

static
void
WINAPI
_OutputDbgStr(
__in  LPSTR szFile,
__in  DWORD dwLine,
__in  LPSTR szMsg,
__in  DWORD dwStatus)
{
    CHAR rgsz[256];
    LPSTR szTag = "INFO";

    if (0 != dwStatus)
        szTag = "ERROR";

    StringCbPrintfA(
        rgsz,
        sizeof(rgsz),
        "%s: %s - 0x%x, file %s, line %d\n",
        szTag,
        szMsg,
        dwStatus,
        szFile,
        dwLine);
    OutputDebugStringA(rgsz);
}

#define CHECK_COM(_X) {                                             \
    if (FALSE == SUCCEEDED(hr = _X)) {                              \
        _OutputDbgStr(__FILE__, __LINE__, #_X, (DWORD) hr);         \
        goto Cleanup;                                               \
            }                                                               \
}

#define CHECK_BOOL(_X) {                                            \
    if (FALSE == (_X)) {                                            \
        hr = HRESULT_FROM_WIN32(GetLastError());                    \
        _OutputDbgStr(__FILE__, __LINE__, #_X, (DWORD) hr);         \
        goto Cleanup;                                               \
            }                                                               \
}

#define CHECK_PTR(_X) {                                             \
    if (NULL == (_X)) {                                             \
        hr = HRESULT_FROM_WIN32(GetLastError());                    \
        _OutputDbgStr(__FILE__, __LINE__, #_X, (DWORD) hr);         \
        goto Cleanup;                                               \
            }                                                               \
}

#define CHECK_ALLOC(_X) {                                           \
    if (NULL == (_X)) {                                             \
        hr = E_OUTOFMEMORY;                                         \
        _OutputDbgStr(__FILE__, __LINE__, #_X, (DWORD) hr);         \
        goto Cleanup;                                               \
            }                                                               \
}

//
// Class implementation
//

STDMETHODIMP CSnCliPlugin::NotifySecurityStatus(
    ULONG ulIsSecure)
{
    HRESULT hr = S_OK;
    UNREFERENCED_PARAMETER(ulIsSecure);
    //Cleanup:
    return hr;
}

STDMETHODIMP CSnCliPlugin::GetSecurityStatus(
    ULONG* pulIsSecure,
    LPWSTR *ppwszMessage)
{
    HRESULT hr = S_OK;
    UNREFERENCED_PARAMETER(pulIsSecure);
    UNREFERENCED_PARAMETER(ppwszMessage);
    //Cleanup:
    return hr;
}

